#ifndef __DIRECT3D_INTERFACE_HEADER__
#define __DIRECT3D_INTERFACE_HEADER__


class GraphicDeviceD3D11
{
public:
	GraphicDeviceD3D11();
	virtual ~GraphicDeviceD3D11();

	bool Initialize(int width, int height, bool fullscreen);
	void Finalize();

	void Present()	
	{ 
		m_pdxgiSwapChain->Present(0,0);	

		float clrClear[4] = {0, 0, 1, 0};
		m_pd3dImmediateContext->ClearDepthStencilView(m_pd3dDepthStencilView, D3D10_CLEAR_DEPTH, 1.f, 0);
		m_pd3dImmediateContext->ClearRenderTargetView(m_pd3dRenderTargetView, clrClear);
		m_pd3dImmediateContext->OMSetRenderTargets( 1, &m_pd3dRenderTargetView, m_pd3dDepthStencilView );
	}

	ID3D11Device*			GetDevice()				{ return m_pd3dDevice;				}
	ID3D11DeviceContext*	GetImmediateContext()	{ return m_pd3dImmediateContext;	}

private:

	static LRESULT CALLBACK WinProcStatic(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); 
	
	HRESULT CreateEngineWindow(int& width, int& height, bool fullscreen);


private:
	HWND					m_hWnd;
	HINSTANCE				m_hInstance;

	ID3D11Device*			m_pd3dDevice;
	ID3D11DeviceContext*	m_pd3dImmediateContext;

	DXGI_SWAP_CHAIN_DESC	m_descSwapChain;
	IDXGISwapChain*			m_pdxgiSwapChain;

	ID3D11RenderTargetView*	m_pd3dRenderTargetView; 
	ID3D11DepthStencilView*	m_pd3dDepthStencilView;

	ID3D11SamplerState*		m_pd3dSamplerLinear;

};

#endif
